<%@ LANGUAGE="VBSCRIPT" %>
<%'  ------------------------------------------------------------
  '  mz_viewprops.asp 
  '  ------------------------------------------------------------
  '  VCS INFO:
  '  
  '  $Revision:   1.22  $
  '  $Date:   14 May 1999 18:06:36  $
  '  $Author:   shsieh  $
  '  $Workfile:   mz_viewprops.asp  $
  '  ------------------------------------------------------------
  '  All Rights Reserved.  Copyright (c) 1988-1998 FileNET Corp.
  '  ------------------------------------------------------------
  '%>
<!-- #include file="islogon.asp" -->
<!-- #include file="notimpl.asp" -->

<!-- Get user credentials
  -->
<%
DebugFlag = 0

ObjType = CInt(Request.QueryString("Type"))
Ident = Request.QueryString("Ident")
Update = Request.QueryString("Update")
bModify = CInt(Request("Modify"))

'Panagon IDM Web application uses the Session variable LibraryLogonID to keep track of
'whether the user has logged on.
'Please see logoncall.asp to see how the Session variable LibraryLogonID is set.
LibraryLogonID = Session("LibraryLogonID")
set LibraryObj = Server.CreateObject("IDMObjects.Library")
LibraryObj.LogonID = LibraryLogonID
%>

<SCRIPT LANGUAGE="JavaScript">
<!--

function Update()
{
    document.property.action = "mz_fPropUpd.asp";
    document.property.UpdateFlag.value = "1";
    document.property.submit();
}

//-->
</SCRIPT>

<!-- Validate that this is an IDM Document Services and not an IDM Image Services 
   -
   - The page propcontent.asp is a similar page for IDM Image Services.
   -
  -->

<% 
    if LibraryObj.SystemType = Application("idmSysTypeIS") then
%>

<HTML>
    <HEAD>
        <TITLE>Redirecting you to the proper page for your library</TITLE>
        <META HttpEquiv="Refresh" Content="10; URL=propcontent.asp?Type=<%=ObjType%>&Update=<%=Update%>&Status=<%=Status%>&Library=<%Library%>&Ident=<%=Ident%>">
    </HEAD> 
    <BODY>
    <H2>Redirecting to property screen</H2>
    You are currently logged into an IDM Imaging Services library and trying to use an IDM Document Services specific page.
    We are redirecting you to the <a href="propcontent.asp?Type=<%=ObjType%>&Update=<%=Update%>&Status=<%=Status%>&Library=<%Library%>&Ident=<%=Ident%>">
    proper page</a>.
    </BODY>
</HTML>

<%
    'We don't want to display any more, because we're on the wrong page
    Response.End
    end if
%>

<!-- Display the properties of the document 
   -
   -->

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html">
<meta name="GENERATOR" content="">
<title>Property View</title>
</head>

<body bgcolor="#FFFFFF">

<%
' get the folder / document object
On Error Resume Next
set FObj = LibraryObj.GetObject(ObjType, Ident)
if Len(Err.Description) then
    Response.Expires = 0
    Response.Status = "404 Not Found"
    Response.ContentType = "text/plain"
    Response.Write "Document not found: "
    Response.Write Err.Description
    Response.End
end if


%>

<table border="0" cellpadding="4" cellspacing="0">
    <tr>
        <td nowrap>
        <% if ObjType = Application("idmObjTypeDocument") then %>
        <img src="images/ldoc.gif" width="34" height="39">
        <% else %>
        <img src="images/lfolder.gif" width="38" height="39">
        <% end if %>
        <font size="3"><strong><%= Ident %> : <%=Server.HTMLEncode(FObj.Label) %></strong></font>
        </td>
    </tr>
</table>



<% 
set Props = FObj.properties
%>
<form name="property"  method="POST">
<table border="0" cellpadding="0" cellspacing="1">
    <tr>
    <td>&nbsp;</td>
    <td colspan=4>
    </td>
    <td align=right nowrap>
    </td>
    </tr>
    <tr>
        <td align="center" width="30">&nbsp;</td>
        <td align="center" width="200" bgcolor="#EECCFF"><font size="3"><strong>Property</strong></font></td>
        <td align="center" width="200" bgcolor="#EECCFF"><font size="3"><strong>Value</strong></font></td>
    </tr>


<% if ObjType = Application("idmObjTypeDocument") then %>
    <% 
    ' enumerate through the object Properties and display their values
    for i=1 to Props.Count
        set Prop = Props(i)
        set PropDesc = Prop.PropertyDescription %>
        
        <tr>
        <td valign=bottom align=right></td>
        <td valign=bottom><em><%= Server.HTMLEncode(Prop.Label) %></em></td>
        <% if Prop.TypeID = 9 then 'idmTypeObject, a multivalued property 
            set MVProp = Prop.Value ' object is a MultipleValues
            ' for a MultiValueProp, FormatValue provides the string of comma separted values
            StrVal = PropDesc.FormatValue(MVProp)
        %>
            <td valign=bottom><%= Server.HTMLEncode(StrVal) %></td>
            <% else ' all other properties %>
            <td valign=bottom><%= Server.HTMLEncode(Prop.FormatValue) %></td>
        <% end if %>
        </tr>
    <% next %>
<% else 'folder display for FO STR. %>
    <tr>
        <td valign=bottom align=right></td>
        <td valign=bottom><em>Name</em></td>
        <td valign=bottom><%=Server.HTMLEncode(FObj.Name) %></td>
    </tr>
    <tr>
        <td valign=bottom align=right></td>
        <td valign=bottom><em>ID</em></td>
        <td valign=bottom><%=Server.HTMLEncode(FObj.ID) %></td>
    </tr>
    <tr>
        <td valign=bottom align=right></td>
        <td valign=bottom><em>Comment</em></td>
        <% if FObj.GetState(Application("idmFolderCanModify")) and bModify = 1 then 
        cValue = FObj.Properties("idmComment").Value
        %>
        <td><input type="text" size="50" name="COMMENT" maxlength=64 value="<%=cValue%>"> </td>
        <% else %>
        <td valign=bottom><%=Server.HTMLEncode(FObj.GetExtendedProperty("idmComment")) %></td>
        <% end if %>
    </tr>
<% end if %>
</table>
<input type="hidden" name="Type" value="<%= ObjType %>">
<input type="hidden" name="Ident" value="<%= Ident %>">
<input type="hidden" name="UpdateFlag" value="1">
<input type="hidden" name="CheckIn" value="No">
</form>

<hr>
<table border="0" cellpadding="0" cellspacing="1">
    <tr>
    <td width="30" valign=bottom align=right></td>
    <td>
    <% if not IsVirtual then %>
        <%
        ' for a Document object, display Checkin / Cancel Checkout / Checkout buttons
        if ObjType = Application("idmObjTypeDocument") then
            ' check if to dislpay the Modify properties button
            if FObj.GetState(Application("idmDocCanModifyProperties")) then
         %>
    <a target="_top" href="property.asp?Ident=<%=Ident%>&Type=<%=ObjType%>&Modify=1"><img alt="Modify" src="images/modify.gif" align=bottom border=0 width=47 height=43></a><em><strong>Modify Properties</strong></em>
            <% end if %>
    <a target="_top" href="security.asp?Ident=<%=Ident%>&Type=<%=ObjType%>"><img alt="Security" src="images/lockbut.gif" align=bottom border=0 width=47 height=43></a><em><strong>View Security</strong></em>
        <% else ' case of folder
            if bModify = 1 then
         %>
    <a href="javascript:Update()"><img alt="Update Properties" src="images/update.gif" align=bottom border=0 width=41 height=41></a><em><strong>Update</strong></em>
    <a target="_top" href="security.asp?Ident=<%=Ident%>&Type=<%=ObjType%>&Modify=1"><img alt="Modify Security" src="images/lockbut.gif" align=bottom border=0 width=47 height=43></a><em><strong>Modify Security</strong></em>
            <% else 
                ' check if to dislpay the Modify properties button
                if FObj.GetState(Application("idmFolderCanModify")) then
            %>
    <a target="_top" href="property.asp?Ident=<%=Ident%>&Type=<%=ObjType%>&Modify=1"><img alt="Modify" src="images/modify.gif" align=bottom border=0 width=47 height=43></a><em><strong>Modify Properties</strong></em>
                <% end if %>
    <a target="_top" href="security.asp?Ident=<%=Ident%>&Type=<%=ObjType%>"><img alt="Security" src="images/lockbut.gif" align=bottom border=0 width=47 height=43></a><em><strong>View Security</strong></em>
            <% end if %>
        <% end if %>
    
        <%if ObjType = Application("idmObjTypeDocument") then 
           if not FObj.GetState(Application("idmDocHasChild")) then
            if FObj.GetState(Application("idmDocCheckedOut")) then 
                if FObj.GetState(Application("idmDocCanCheckin")) then
    %>
    <a target="_top" href="checkin.asp?DocID=<%=Ident%>"><img alt="CheckIn" src="images/ckin.gif" align=bottom border=0 width=47 height=43></a><em><strong>Check In</strong></em>
                <% end if 
                if FObj.GetState(Application("idmDocCanCancelCheckout")) then
                %>
    <a target="_top" href="doccnclckout.asp?DocID=<%=Ident%>&Redirect=property.asp"><img alt="CancelCheckOut" src="images/canckout.gif" align=bottom border=0 width=47 height=43></a><em><strong>Cancel Checkout</strong></em>
            <%  end if
            else 
                if FObj.GetState(Application("idmDocCanCheckout")) then
            %>
    <a target="_top" href="doccontent.asp?checkout=1&DocID=<%=Ident%>"><img alt="CheckOut" src="images/ckout.gif" align=bottom border=0 width=47 height=43></a><em><strong>Check Out</strong></em>
    
        <% 
                end if
            end if
		   end if
        end if %>
    <% end if %>
    </td>
    </tr>
</table>

</body>
</html>
